import { defineConfig, loadEnv } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
import viteCompression from "vite-plugin-compression";
// https://vitejs.dev/config/
export default ({ mode }) => {
    const env = loadEnv(mode, process.cwd()); // 获取.env文件里定义的环境变量

    return defineConfig({
        plugins: [vue(), viteCompression()],
        base: "./", //打包路径
        build: {
            outDir: "dist",
        },
        resolve: {
            alias: [
                {
                    find: "@",
                    replacement: resolve(__dirname, "./src"),
                },
            ],
        },
        server: {
            host: `0.0.0.0`,
            port: 80,
            open: true,
            proxy: {
                "/ItApp-Common-Auth": {
                    target: "http://10.86.230.108:8083", // sit
                    changeOrigin: true,
                },
            },
        },
    });
};
